import request from '@/utils/request'
import qs from 'qs'

export function login(data) {
    console.log(data);
    return request({
        url: 'manager/login',
        method: 'post',
        headers: { 'content-type': 'application/x-www-form-urlencoded' },
        data: qs.stringify(data)
    })
}

export function getInfo(token) {
    return request({
        url: 'manager/info',
        method: 'get',
        params: { token }
    })
}

export function logout() {
    return request({
        url: 'manager/logout',
        method: 'post'
    })
}
export function getUsers(current, limit) {
    return request({
        url: `manager/user/pageUsers/${current}/${limit}`,
        method: 'get'
    })
}
export function deleteUserById(id) {
    return request({
        url: `manager/user/deleteUserById/${id}`,
        method: 'delete'
    })
}
export function getUserById(id) {
    return request({
        url: `manager/user/getUserById/${id}`,
        method: 'get'
    })
}
export function updateUser(user) {
    return request({
        url: 'manager/user/updateUser',
        method: 'post',
        data: qs.stringify(user)
    })
}

export function getCode(id) {
    return request({
        url: `manager/user/getUserQRCode/${id}`,
        method: 'get'
    })
}